package simple.enums;

public enum EWDirection {
	EAST,
	WEST;

	public static EWDirection parseString(String direction) throws IllegalArgumentException {
		String d = direction.trim();
		if(d.equalsIgnoreCase("e") || d.equals("east")){
			return EWDirection.EAST;
		}
		else if(d.equalsIgnoreCase("w") || d.equals("west")){
			return EWDirection.WEST;
		}
		else{
			throw new IllegalArgumentException("Valid arguments are: {e, east, w, west}.");
		}
	}
}
